package com.example.androidframework.impl

import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.LifecycleOwner

class FishLifecycleObserver : DefaultLifecycleObserver {
    override fun onCreate(owner: LifecycleOwner) {
        super.onCreate(owner)
    }

    override fun onStart(owner: LifecycleOwner) {
        super.onStart(owner)
    }

    override fun onResume(owner: LifecycleOwner) {
        super.onResume(owner)
    }

    override fun onPause(owner: LifecycleOwner) {
        super.onPause(owner)
    }

    override fun onStop(owner: LifecycleOwner) {
        super.onStop(owner)
    }

    override fun onDestroy(owner: LifecycleOwner) {
        super.onDestroy(owner)
    }
}

class FishLifecycleEventObserver : LifecycleEventObserver {
    //监听对应的生命周期的切换
    override fun onStateChanged(source: LifecycleOwner, event: Lifecycle.Event) {

    }
}


/*
    使用：
    val lifecycle = FishLifecycleObserver()
    // 在activity/Fragment中注册
    lifecycle.addObserver(TestLifecycleClassA())
    lifecycle.addObserver(TestLifecycleClassB())
*/